package com.youdianda.controller.user;


import com.youdianda.dto.*;
import com.youdianda.entity.YddArticle;
import com.youdianda.result.Result;
import com.youdianda.service.IYddArticleService;
import com.youdianda.service.IYddUserDataService;
import com.youdianda.service.IYddUserService;
import com.youdianda.service.UserMyArticleService;
import com.youdianda.vo.PageResult;
import com.youdianda.vo.UserDataListVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 我的文章
 */

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private IYddUserService yddUserService;

    @Autowired
    private IYddUserDataService yddUserDataService;

    /**
     * 修改用户资料
     * @return
     */
    @PostMapping("/update")
    public Result updateUser(@RequestBody UpdateUserDTO updateUserDTO){
        return yddUserService.updateUser(updateUserDTO);
    }

    /**
     * GET 点赞/取消点赞和收藏/取消收藏
     * @param userDataHandleDTO
     * @return
     */
    @GetMapping("/userDataHandle")
    public Result userDataHandle( UserDataHandleDTO userDataHandleDTO){
        return yddUserDataService.userDataHandle(userDataHandleDTO);
    }

}
